package game;

import java.awt.Color;
import java.awt.Graphics;
import java.util.Vector;

import javax.swing.JFrame;

public class Level {
	
	JFrame frame;
	VisibleMarine player;
	Vector<VisibleCharacter> bandOfVilain = new Vector<VisibleCharacter>();
	Graphics g;
	
	public Level(){
		frame = new JFrame();
		frame.setSize(GameStandards.FRAME_HEIGHT, GameStandards.FRAME_WIDTH);
		frame.setVisible(true);
//		frame.pack();
//		frame.setLayout(new BorderLayout());
//		JButton button = new JButton("lol");
//		frame.add("North", button);
		
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		
		g = frame.getGraphics();
		player = new VisibleMarine(new Marine("Fred"), g, 300, 300, Color.green);
		
		for (int i=0; i < 20; i++){
		addNewEnnemy("bg"+i, i * 15, 30);
		}
		
		frame.addKeyListener(new PlayerCommand(player, this));
		frame.repaint();
	}
	
	public void addNewEnnemy(String name, int x, int y){
		VisibleBadGuy tmp = new VisibleBadGuy(new Marine(name), this.g, x, y, Color.red);
		tmp.setTarget(player);
		bandOfVilain.add(tmp);
		tmp.start();
	}
	
	public Graphics getGraphics(){
		return g;
	}
	
	public Vector<VisibleCharacter> getEnnemies(){
		return bandOfVilain;
	}

}
